package com.lance.shiro.web;

import com.lance.shiro.entity.ISolicitor;
import com.lance.shiro.service.SolicitorService;
import com.lance.shiro.utils.RequestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/rest/solicitor")
public class SolicitorController extends BaseController<ISolicitor> {

    private SolicitorService solicitorService;

    @Autowired
    public SolicitorController(SolicitorService solicitorService){
        super(solicitorService);
        this.solicitorService=solicitorService;
    }

    @Override
    @RequestMapping(method=RequestMethod.POST, consumes={MediaType.APPLICATION_JSON_VALUE})
    public ResponseEntity create(@RequestBody ISolicitor json) {
        log.debug("SolicitorController create() with body {} of type {}", json, json.getClass());
        ISolicitor ret = solicitorService.insert(json);
        return RequestUtils.success("Operation success!", ret);
    }
}